package java课题设计.功能类.Seek;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
//搜索学生类
 
public class SeekStudent extends JFrame implements MouseListener {
    Font f =new Font("宋体",Font.BOLD,25);
    JButton SeekID = new JButton("按学号查找");
    JFrame pre;
    public SeekStudent(JFrame pre){
        extracted();
        image();
 
        this.setVisible(true);
    }
    public void extracted(){
        this.setSize(488,430);
        this.setTitle("选择查找方式");
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo(null);
        this.setLayout(null);
        this.setAlwaysOnTop(true);
 
 
        //绑定监听事件
        SeekID.addMouseListener(this);
    }
    public void image(){
 
        //添加"按照学号查找"按钮
        SeekID.setBounds(116,80,247,80);
        SeekID.setFont(f);
        this.getContentPane().add(SeekID);
 
 
    }
    @Override
    protected void processWindowEvent(WindowEvent e){
        super.processWindowEvent(e);
        if(e.getID()==WindowEvent.WINDOW_CLOSED){
            this.setVisible(false);//隐藏当前窗口
            pre.setVisible(true);//显示上一级窗口
        }
    }
 
    @Override
    public void mouseClicked(MouseEvent e) {
        if(e.getSource()==SeekID){
            //打开查找ID界面，关闭当前界面
            //System.out.println("按照学号查找");
            new Seekid(this);
            this.setVisible(false);
 
        }
       
    }
 
    @Override
    public void mousePressed(MouseEvent e) {
 
    }
 
    @Override
    public void mouseReleased(MouseEvent e) {
 
    }
 
    @Override
    public void mouseEntered(MouseEvent e) {
 
    }
 
    @Override
    public void mouseExited(MouseEvent e) {
 
    }
}
